home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / new_file / falcon / dsppaula / dsppaula.lzh / pro__11b.q < prev    next >
Text File  |  1993-05-15  |  39KB  |  1,233 lines

  1.  
  2. ;********************************************
  3. ;* ----- Protracker V1.1B Playroutine ----- *
  4. ;* Lars "Zap" Hamre/Amiga Freelancers 1991  *
  5. ;* Bekkeliveien 10, N-2010 STR╪MMEN, Norway *
  6. ;********************************************
  7.  
  8. ; VBlank Version 2:
  9. ; Call mt_init to initialize the routine, then call mt_music on
  10. ; each vertical blank (50 Hz). To end the song and turn off all
  11. ; voices, call mt_end.
  12.  
  13. ; This playroutine is not very fast, optimized or well commented,
  14. ; but all the new commands in PT1.1A should work.
  15. ; If it's not good enough, you'll have to change it yourself.
  16. ; We'll try to write a faster routine soon...
  17.  
  18. ; Changes from V1.0C playroutine:
  19. ; - Vibrato depth changed to be compatible with Noisetracker 2.0.
  20. ;   You'll have to double all vib. depths on old PT modules.
  21. ; - Funk Repeat changed to Invert Loop.
  22. ; - Period set back earlier when stopping an effect.
  23.  
  24. ***************************************************************************
  25. dff096_contr:
  26.         move.w    d0,-(sp)
  27.         move.w    4+2(sp),d0
  28.         btst    #15,d0                    ;Bits setzen?
  29.         bne.s    ap_bits_set
  30.         not.w    d0
  31.         and.w    d0,dff096                ;Bits löschen
  32.         bra.s    dff096_contr_end
  33. ap_bits_set:
  34.         or.w    d0,dff096                ;Bits setzen
  35. dff096_contr_end:
  36.         move.w    (sp)+,d0
  37.         rts
  38. ***************************************************************************
  39. DMAWAIT       EQU 300                   ; Set this as low as possible without losing low notes.
  40.  
  41. N_NOTE        EQU 0                     ; W
  42. N_CMD         EQU 2                     ; W
  43. N_CMDLO       EQU 3                     ; B
  44. N_START       EQU 4                     ; L
  45. N_LENGTH      EQU 8                     ; W
  46. N_LOOPSTART   EQU 10                    ; L
  47. N_REPLEN      EQU 14                    ; W
  48. N_PERIOD      EQU 16                    ; W
  49. N_FINETUNE    EQU 18                    ; B
  50. N_VOLUME      EQU 19                    ; B
  51. N_DMABIT      EQU 20                    ; W
  52. N_TONEPORTDIREC EQU 22                  ; B
  53. N_TONEPORTSPEED EQU 23                  ; B
  54. N_WANTEDPERIOD EQU 24                   ; W
  55. N_VIBRATOCMD  EQU 26                    ; B
  56. N_VIBRATOPOS  EQU 27                    ; B
  57. N_TREMOLOCMD  EQU 28                    ; B
  58. N_TREMOLOPOS  EQU 29                    ; B
  59. N_WAVECONTROL EQU 30                    ; B
  60. N_GLISSFUNK   EQU 31                    ; B
  61. N_SAMPLEOFFSET EQU 32                   ; B
  62. N_PATTPOS     EQU 33                    ; B
  63. N_LOOPCOUNT   EQU 34                    ; B
  64. N_FUNKOFFSET  EQU 35                    ; B
  65. N_WAVESTART   EQU 36                    ; L
  66. N_REALLENGTH  EQU 40                    ; W
  67. *************************************************************************
  68. ;original coded by Aeon of AURA
  69. ;DSP-Anpassung by Chris of AURA
  70. ;a6: Modulbeginn
  71. ap_mod_init:    
  72.             move.l    a6,mt_songdataptr    ;Moduladr. speichern
  73.             lea        $03b6(a6),a0        ;songlength-adresse
  74.             cmpm.b     (a0)+,(a0)+            ;repeat <= songlength
  75.             bls.s     ap_no_buggy            ;dann alles ok
  76.             clr.b     -1(a0)                ;sonst bug entfernen
  77.  
  78. ;a0: sequenzer-adresse
  79. ap_no_buggy:
  80.             moveq     #$0080-1,d0            ;max.128 positions
  81.             moveq     #0,d1                ;max-pattern = 0
  82.  
  83. ap_search_max:
  84.             cmp.b     (a0)+,d1            ;pattern > d1
  85.             bhi.s     ap_searching        ;sonst weitersuchen
  86.             move.b     -1(a0),d1            ;max übernehmen
  87. ap_searching:
  88.             dbra     d0,ap_search_max    ;alle 128 positions durchsuchen
  89.             addq.l     #1,d1                ;max-pattern +1
  90.             moveq     #10,d0                ;10 mal shiften
  91.             lsl.l     d0,d1                ;*1024 (1024 bytes pro pattern)
  92.  
  93.             lea        (a6),a0                ;module-adresse
  94.             lea        $0014+$0016(a0),a1    ;zeiger aus länge sample 1
  95.             adda.w     #$043c,a0            ;offset zu den patterns
  96.             adda.l     d1,a0                ;adresse sample 1
  97.             lea        mt_samplestarts(pc),a2    ;sample-tabelle
  98.             moveq     #31-1,d0            ;max.31 instumente
  99.             moveq     #0,d2                ;anzahl intrumente = 0
  100.             
  101. ap_set_tabl:
  102.             move.l     a0,(a2)+            ;adresse in tabelle eintragen
  103.             moveq     #0,d1                ;d1.l löschen
  104.             move.w     (a1),d1                ;sample-length lesen
  105.             beq.s     ap_any_spl            ;0:kein sample
  106.             add.l    d1,d1                ;*2
  107.             adda.l     d1,a0                ;adresse des nächsten samples
  108.             addq.w     #1,d2                ;instrumenten-anzahl erhöhen
  109. ap_any_spl:
  110.             lea        $001e(a1),a1        ;zeiger auf nächste länge    setzen
  111.             dbra     d0,ap_set_tabl        ;alle 31 samples
  112.  
  113. ;d2.l:anzahl der instrumente
  114. ;a1.l:ende sample-längen + $1e
  115. ;a2.l:ende sample-tab +    4
  116.             subq.w     #1,d2
  117.             moveq     #31-1,d0            ;max.31 samples
  118. ap_convert_spls:
  119.             lea        -$1e(a1),a1            ;Zeiger auf vorherige Samplelänge
  120.             move.l    -(a2),a0            ;Samplestartadr. holen
  121.             moveq    #0,d3
  122.             move.w    (a1),d3                ;Samplelänge holen            
  123.             beq.s    ap_conv_no_sample
  124.  
  125.             move.w    d2,d1                ;Anzahl vorhandener Samples nach d1
  126.             mulu.w    #330*2,d1            ;* Verschiebedifferenz
  127.             lea        (a0,d1.l),a3        ;neue Sampleadr.
  128.             move.l    a3,(a2)                ;und speichern
  129.             add.l    d3,a0                ;Sampleendadr. errechnen
  130.             add.l    d3,a0
  131.             lea        (a0,d1.l),a3        ;neue Sampleendadr.
  132.             subq.w    #1,d3
  133. ap_copy_up:
  134.             move.w    -(a0),d4            ;Sample holen
  135.             xori.w    #$8080,d4            ;Integerkonvertierung
  136.             move.w    d4,-(a3)            ;und speichern
  137.             dbra    d3,ap_copy_up
  138.             
  139.             move.l    (a2),a3                ;Samplestartadr. holen
  140.             moveq    #0,d3
  141.             move.w    6(a1),d3            ;Repeatlänge holen            
  142.             cmp.w    #1,d3                ;<=1?
  143.             bhi.s    ap_gen_loop
  144.  
  145.             moveq    #0,d3
  146.             move.w    (a1),d3                ;Samplelänge holen
  147.             add.l    d3,a3                ;Sampleende errechnen
  148.             add.l    d3,a3
  149.             move.w    #330-1,d3            ;330 Worte
  150. ap_clr_sample:
  151.             move.w    #$8080,(a3)+        ;löschen
  152.             dbra    d3,ap_clr_sample
  153.             bra.s    ap_nun_weiter
  154.             
  155. ap_gen_loop:
  156.             moveq    #0,d4
  157.             move.w    4(a1),d4
  158.             add.l    d4,a3                ;Startadr. des Loops
  159.             add.l    d4,a3
  160.             lea        (a3,d3.w*2),a4        ;Endadr. des Loops
  161.  
  162.             move.w    #330-1,d3            ;330 Worte
  163. ap_copy_sample:
  164.             move.w    (a3)+,(a4)+            ;kopieren
  165.             dbra    d3,ap_copy_sample
  166.  
  167. ap_nun_weiter:
  168.             subq.w     #1,d2                ;vorhandene samples -1
  169.             bmi.s     ap_conv_ende        ;wasserdicht !
  170. ap_conv_no_sample:
  171.             dbra     d0,ap_convert_spls
  172. ap_conv_ende:
  173. *****************************************************************************
  174.               MOVE.B #6,MT_SPEED
  175.               CLR.B MT_COUNTER
  176.               CLR.B MT_SONGPOS
  177.               CLR.W MT_PATTERNPOS
  178.               CLR.W DFF0A8
  179.               CLR.W DFF0B8
  180.               CLR.W DFF0C8
  181.               CLR.W DFF0D8
  182. *             MOVE.W #$000F,$00DFF096
  183.             move.w    #$f,-(sp)
  184.             bsr        dff096_contr
  185.             addq.w    #2,sp
  186.               RTS
  187. ap_playmusic:
  188. MT_MUSIC:
  189.               MOVEM.L D0-D4/A0-A6,-(SP)
  190.               ADDQ.B #1,MT_COUNTER
  191.               MOVE.B MT_COUNTER(PC),D0
  192.               CMP.B MT_SPEED(PC),D0
  193.               BLO.S MT_NONEWNOTE
  194.               CLR.B MT_COUNTER
  195.               TST.B MT_PATTDELTIME2
  196.               BEQ.S MT_GETNEWNOTE
  197.               BSR.S MT_NONEWALLCHANNELS
  198.               BRA MT_DSKIP
  199.  
  200. MT_NONEWNOTE:
  201.               BSR.S MT_NONEWALLCHANNELS
  202.               BRA MT_NONEWPOSYET
  203.  
  204. MT_NONEWALLCHANNELS:
  205.               LEA DFF0A0,A5
  206.               LEA MT_CHAN1TEMP(PC),A6
  207.               BSR MT_CHECKEFX
  208.               LEA DFF0B0,A5
  209.               LEA MT_CHAN2TEMP(PC),A6
  210.               BSR MT_CHECKEFX
  211.               LEA DFF0C0,A5
  212.               LEA MT_CHAN3TEMP(PC),A6
  213.               BSR MT_CHECKEFX
  214.               LEA DFF0D0,A5
  215.               LEA MT_CHAN4TEMP(PC),A6
  216.               BRA MT_CHECKEFX
  217.  
  218. MT_GETNEWNOTE:
  219.               MOVEA.L MT_SONGDATAPTR(PC),A0
  220.               LEA 12(A0),A3
  221.               LEA 952(A0),A2            ;pattpo
  222.               LEA 1084(A0),A0           ;patterndata
  223.               MOVEQ #0,D0
  224.               MOVEQ #0,D1
  225.               MOVE.B MT_SONGPOS(PC),D0
  226.               MOVE.B 0(A2,D0.w),D1
  227.               ASL.L #8,D1
  228.               ASL.L #2,D1
  229.               ADD.W MT_PATTERNPOS(PC),D1
  230.               CLR.W MT_DMACONTEMP
  231.  
  232.               LEA DFF0A0,A5
  233.               LEA MT_CHAN1TEMP(PC),A6
  234.               BSR.S MT_PLAYVOICE
  235.               LEA DFF0B0,A5
  236.               LEA MT_CHAN2TEMP(PC),A6
  237.               BSR.S MT_PLAYVOICE
  238.               LEA DFF0C0,A5
  239.               LEA MT_CHAN3TEMP(PC),A6
  240.               BSR.S MT_PLAYVOICE
  241.               LEA DFF0D0,A5
  242.               LEA MT_CHAN4TEMP(PC),A6
  243.               BSR.S MT_PLAYVOICE
  244.               BRA MT_SETDMA
  245.  
  246. MT_PLAYVOICE:
  247.               TST.L (A6)
  248.               BNE.S MT_PLVSKIP
  249.               BSR MT_PERNOP
  250. MT_PLVSKIP:
  251.               MOVE.L 0(A0,D1.l),(A6)
  252.               ADDQ.L #4,D1
  253.               MOVEQ #0,D2
  254.               MOVE.B N_CMD(A6),D2
  255.               AND.B #$F0,D2
  256.               LSR.B #4,D2
  257.               MOVE.B (A6),D0
  258.               AND.B #$F0,D0
  259.               OR.B D0,D2
  260.               TST.B D2
  261.               BEQ MT_SETREGS
  262.               MOVEQ #0,D3
  263.               LEA MT_SAMPLESTARTS(PC),A1
  264.               MOVE.W D2,D4
  265.               SUBQ.L #1,D2
  266.               ASL.L #2,D2
  267.               MULU #30,D4
  268.               MOVE.L 0(A1,D2.l),N_START(A6)
  269.               MOVE.W 0(A3,D4.l),N_LENGTH(A6)
  270.               MOVE.W 0(A3,D4.l),N_REALLENGTH(A6)
  271.               MOVE.B 2(A3,D4.l),N_FINETUNE(A6)
  272.               MOVE.B 3(A3,D4.l),N_VOLUME(A6)
  273.               MOVE.W 4(A3,D4.l),D3      ; Get repeat
  274.               TST.W D3
  275.               BEQ.S MT_NOLOOP
  276.               MOVE.L N_START(A6),D2     ; Get start
  277.               ASL.W #1,D3
  278.               ADD.L D3,D2               ; Add repeat
  279.               MOVE.L D2,N_LOOPSTART(A6)
  280.               MOVE.L D2,N_WAVESTART(A6)
  281.               MOVE.W 4(A3,D4.l),D0      ; Get repeat
  282.               ADD.W 6(A3,D4.l),D0       ; Add replen
  283.               MOVE.W D0,N_LENGTH(A6)
  284.               MOVE.W 6(A3,D4.l),N_REPLEN(A6) ; Save replen
  285.               MOVEQ #0,D0
  286.               MOVE.B N_VOLUME(A6),D0
  287.               MOVE.W D0,8(A5)           ; Set volume
  288.               BRA.S MT_SETREGS
  289.  
  290. MT_NOLOOP:
  291.               MOVE.L N_START(A6),D2
  292.               ADD.L D3,D2
  293.               MOVE.L D2,N_LOOPSTART(A6)
  294.               MOVE.L D2,N_WAVESTART(A6)
  295.               MOVE.W 6(A3,D4.l),N_REPLEN(A6) ; Save replen
  296.               MOVEQ #0,D0
  297.               MOVE.B N_VOLUME(A6),D0
  298.               MOVE.W D0,8(A5)           ; Set volume
  299. MT_SETREGS:
  300.               MOVE.W (A6),D0
  301.               AND.W #$0FFF,D0
  302.               BEQ MT_CHECKMOREEFX       ; If no note
  303.               MOVE.W 2(A6),D0
  304.               AND.W #$0FF0,D0
  305.               CMP.W #$0E50,D0
  306.               BEQ.S MT_DOSETFINETUNE
  307.               MOVE.B 2(A6),D0
  308.               AND.B #$0F,D0
  309.               CMP.B #3,D0               ; TonePortamento
  310.               BEQ.S MT_CHKTONEPORTA
  311.               CMP.B #5,D0
  312.               BEQ.S MT_CHKTONEPORTA
  313.               CMP.B #9,D0               ; Sample Offset
  314.               BNE.S MT_SETPERIOD
  315.               BSR MT_CHECKMOREEFX
  316.               BRA.S MT_SETPERIOD
  317.  
  318. MT_DOSETFINETUNE:
  319.               BSR MT_SETFINETUNE
  320.               BRA.S MT_SETPERIOD
  321.  
  322. MT_CHKTONEPORTA:
  323.               BSR MT_SETTONEPORTA
  324.               BRA MT_CHECKMOREEFX
  325.  
  326. MT_SETPERIOD:
  327.               MOVEM.L D0-D1/A0-A1,-(SP)
  328.               MOVE.W (A6),D1
  329.               AND.W #$0FFF,D1
  330.               LEA MT_PERIODTABLE(PC),A1
  331.               MOVEQ #0,D0
  332.               MOVEQ #36,D7
  333. MT_FTULOOP:
  334.               CMP.W 0(A1,D0.w),D1
  335.               BHS.S MT_FTUFOUND
  336.               ADDQ.L #2,D0
  337.               DBRA D7,MT_FTULOOP
  338. MT_FTUFOUND:
  339.               MOVEQ #0,D1
  340.               MOVE.B N_FINETUNE(A6),D1
  341.               MULU #36*2,D1
  342.               ADDA.L D1,A1
  343.               MOVE.W 0(A1,D0.w),N_PERIOD(A6)
  344.               MOVEM.L (SP)+,D0-D1/A0-A1
  345.  
  346.               MOVE.W 2(A6),D0
  347.               AND.W #$0FF0,D0
  348.               CMP.W #$0ED0,D0           ; Notedelay
  349.               BEQ MT_CHECKMOREEFX
  350.  
  351. *              MOVE.W N_DMABIT(A6),$00DFF096
  352.             move.w    n_dmabit(a6),-(sp)
  353.             bsr        dff096_contr
  354.             addq.w    #2,sp
  355.               BTST #2,N_WAVECONTROL(A6)
  356.               BNE.S MT_VIBNOC
  357.               CLR.B N_VIBRATOPOS(A6)
  358. MT_VIBNOC:
  359.               BTST #6,N_WAVECONTROL(A6)
  360.               BNE.S MT_TRENOC
  361.               CLR.B N_TREMOLOPOS(A6)
  362. MT_TRENOC:
  363.               MOVE.L N_START(A6),(A5)   ; Set start
  364.               MOVE.W N_LENGTH(A6),4(A5) ; Set length
  365.               MOVE.W N_PERIOD(A6),D0
  366.               MOVE.W D0,6(A5)           ; Set period
  367.               MOVE.W N_DMABIT(A6),D0
  368.               OR.W D0,MT_DMACONTEMP
  369.               BRA MT_CHECKMOREEFX
  370.  
  371. MT_SETDMA:
  372. *              MOVE.W #300,D0
  373. *MT_WAITDMA:
  374. *              DBRA D0,MT_WAITDMA
  375.               MOVE.W MT_DMACONTEMP(PC),D0
  376.               OR.W #$8000,D0
  377. *              MOVE.W D0,$00DFF096
  378.             move.w    d0,-(sp)
  379.             bsr        dff096_contr
  380.             addq.w    #2,sp
  381. *              MOVE.W #300,D0
  382. *MT_WAITDMA2:
  383. *              DBRA D0,MT_WAITDMA2
  384.  
  385.               LEA DFF0A0+$000A,A5
  386.               LEA MT_CHAN4TEMP(PC),A6
  387.               MOVE.L N_LOOPSTART(A6),$00D0-$a0(A5)
  388.               MOVE.W N_REPLEN(A6),$00D4-$a0(A5)
  389.               LEA MT_CHAN3TEMP(PC),A6
  390.               MOVE.L N_LOOPSTART(A6),$00C0-$a0(A5)
  391.               MOVE.W N_REPLEN(A6),$00C4-$a0(A5)
  392.               LEA MT_CHAN2TEMP(PC),A6
  393.               MOVE.L N_LOOPSTART(A6),$00B0-$a0(A5)
  394.               MOVE.W N_REPLEN(A6),$00B4-$a0(A5)
  395.               LEA MT_CHAN1TEMP(PC),A6
  396.               MOVE.L N_LOOPSTART(A6),$00A0-$a0(A5)
  397.               MOVE.W N_REPLEN(A6),$00A4-$a0(A5)
  398.  
  399. MT_DSKIP:
  400.               ADDI.W #16,MT_PATTERNPOS
  401.               MOVE.B MT_PATTDELTIME,D0
  402.               BEQ.S MT_DSKC
  403.               MOVE.B D0,MT_PATTDELTIME2
  404.               CLR.B MT_PATTDELTIME
  405. MT_DSKC:      TST.B MT_PATTDELTIME2
  406.               BEQ.S MT_DSKA
  407.               SUBQ.B #1,MT_PATTDELTIME2
  408.               BEQ.S MT_DSKA
  409.               SUBI.W #16,MT_PATTERNPOS
  410. MT_DSKA:      TST.B MT_PBREAKFLAG
  411.               BEQ.S MT_NNPYSK
  412.               SF  MT_PBREAKFLAG
  413.               MOVEQ #0,D0
  414.               MOVE.B MT_PBREAKPOS(PC),D0
  415.               CLR.B MT_PBREAKPOS
  416.               LSL.W #4,D0
  417.               MOVE.W D0,MT_PATTERNPOS
  418. MT_NNPYSK:
  419.               CMPI.W #1024,MT_PATTERNPOS
  420.               BLO.S MT_NONEWPOSYET
  421. MT_NEXTPOSITION:
  422.               MOVEQ #0,D0
  423.               MOVE.B MT_PBREAKPOS(PC),D0
  424.               LSL.W #4,D0
  425.               MOVE.W D0,MT_PATTERNPOS
  426.               CLR.B MT_PBREAKPOS
  427.               CLR.B MT_POSJUMPFLAG
  428.               ADDQ.B #1,MT_SONGPOS
  429.               ANDI.B #$7F,MT_SONGPOS
  430.               MOVE.B MT_SONGPOS(PC),D1
  431.               MOVEA.L MT_SONGDATAPTR(PC),A0
  432.               CMP.B 950(A0),D1
  433.               BLO.S MT_NONEWPOSYET
  434.               CLR.B MT_SONGPOS
  435. MT_NONEWPOSYET:
  436.               TST.B MT_POSJUMPFLAG
  437.               BNE.S MT_NEXTPOSITION
  438.               MOVEM.L (SP)+,D0-D4/A0-A6
  439.               RTS
  440.  
  441. MT_CHECKEFX:
  442.               BSR MT_UPDATEFUNK
  443.               MOVE.W N_CMD(A6),D0
  444.               AND.W #$0FFF,D0
  445.               BEQ.S MT_PERNOP
  446.               MOVE.B N_CMD(A6),D0
  447.               AND.B #$0F,D0
  448.               BEQ.S MT_ARPEGGIO
  449.               CMP.B #1,D0
  450.               BEQ MT_PORTAUP
  451.               CMP.B #2,D0
  452.               BEQ MT_PORTADOWN
  453.               CMP.B #3,D0
  454.               BEQ MT_TONEPORTAMENTO
  455.               CMP.B #4,D0
  456.               BEQ MT_VIBRATO
  457.               CMP.B #5,D0
  458.               BEQ MT_TONEPLUSVOLSLIDE
  459.               CMP.B #6,D0
  460.               BEQ MT_VIBRATOPLUSVOLSLIDE
  461.               CMP.B #$0E,D0
  462.               BEQ MT_E_COMMANDS
  463. SETBACK:      MOVE.W N_PERIOD(A6),6(A5)
  464.               CMP.B #7,D0
  465.               BEQ MT_TREMOLO
  466.               CMP.B #$0A,D0
  467.               BEQ MT_VOLUMESLIDE
  468. MT_RETURN2:
  469.               RTS
  470.  
  471. MT_PERNOP:
  472.               MOVE.W N_PERIOD(A6),6(A5)
  473.               RTS
  474.  
  475. MT_ARPEGGIO:
  476.               MOVEQ #0,D0
  477.               MOVE.B MT_COUNTER(PC),D0
  478.               DIVS #3,D0
  479.               SWAP D0
  480.               CMP.W #0,D0
  481.               BEQ.S MT_ARPEGGIO2
  482.               CMP.W #2,D0
  483.               BEQ.S MT_ARPEGGIO1
  484.               MOVEQ #0,D0
  485.               MOVE.B N_CMDLO(A6),D0
  486.               LSR.B #4,D0
  487.               BRA.S MT_ARPEGGIO3
  488.  
  489. MT_ARPEGGIO1:
  490.               MOVEQ #0,D0
  491.               MOVE.B N_CMDLO(A6),D0
  492.               AND.B #15,D0
  493.               BRA.S MT_ARPEGGIO3
  494.  
  495. MT_ARPEGGIO2:
  496.               MOVE.W N_PERIOD(A6),D2
  497.               BRA.S MT_ARPEGGIO4
  498.  
  499. MT_ARPEGGIO3:
  500.               ASL.W #1,D0
  501.               MOVEQ #0,D1
  502.               MOVE.B N_FINETUNE(A6),D1
  503.               MULU #36*2,D1
  504.               LEA MT_PERIODTABLE(PC),A0
  505.               ADDA.L D1,A0
  506.               MOVEQ #0,D1
  507.               MOVE.W N_PERIOD(A6),D1
  508.               MOVEQ #36,D7
  509. MT_ARPLOOP:
  510.               MOVE.W 0(A0,D0.w),D2
  511.               CMP.W (A0),D1
  512.               BHS.S MT_ARPEGGIO4
  513.               ADDQ.L #2,A0
  514.               DBRA D7,MT_ARPLOOP
  515.               RTS
  516.  
  517. MT_ARPEGGIO4:
  518.               MOVE.W D2,6(A5)
  519.               RTS
  520.  
  521. MT_FINEPORTAUP:
  522.               TST.B MT_COUNTER
  523.               BNE.S MT_RETURN2
  524.               MOVE.B #$0F,MT_LOWMASK
  525. MT_PORTAUP:
  526.               MOVEQ #0,D0
  527.               MOVE.B N_CMDLO(A6),D0
  528.               AND.B MT_LOWMASK(PC),D0
  529.               MOVE.B #$FF,MT_LOWMASK
  530.               SUB.W D0,N_PERIOD(A6)
  531.               MOVE.W N_PERIOD(A6),D0
  532.               AND.W #$0FFF,D0
  533.               CMP.W #113,D0
  534.               BPL.S MT_PORTAUSKIP
  535.               ANDI.W #$F000,N_PERIOD(A6)
  536.               ORI.W #113,N_PERIOD(A6)
  537. MT_PORTAUSKIP:
  538.               MOVE.W N_PERIOD(A6),D0
  539.               AND.W #$0FFF,D0
  540.               MOVE.W D0,6(A5)
  541.               RTS
  542.  
  543. MT_FINEPORTADOWN:
  544.               TST.B MT_COUNTER
  545.               BNE MT_RETURN2
  546.               MOVE.B #$0F,MT_LOWMASK
  547. MT_PORTADOWN:
  548.               CLR.W D0
  549.               MOVE.B N_CMDLO(A6),D0
  550.               AND.B MT_LOWMASK(PC),D0
  551.               MOVE.B #$FF,MT_LOWMASK
  552.               ADD.W D0,N_PERIOD(A6)
  553.               MOVE.W N_PERIOD(A6),D0
  554.               AND.W #$0FFF,D0
  555.               CMP.W #856,D0
  556.               BMI.S MT_PORTADSKIP
  557.               ANDI.W #$F000,N_PERIOD(A6)
  558.               ORI.W #856,N_PERIOD(A6)
  559. MT_PORTADSKIP:
  560.               MOVE.W N_PERIOD(A6),D0
  561.               AND.W #$0FFF,D0
  562.               MOVE.W D0,6(A5)
  563.               RTS
  564.  
  565. MT_SETTONEPORTA:
  566.               MOVE.L A0,-(SP)
  567.               MOVE.W (A6),D2
  568.               AND.W #$0FFF,D2
  569.               MOVEQ #0,D0
  570.               MOVE.B N_FINETUNE(A6),D0
  571.               MULU #37*2,D0
  572.               LEA MT_PERIODTABLE(PC),A0
  573.               ADDA.L D0,A0
  574.               MOVEQ #0,D0
  575. MT_STPLOOP:
  576.               CMP.W 0(A0,D0.w),D2
  577.               BHS.S MT_STPFOUND
  578.               ADDQ.W #2,D0
  579.               CMP.W #37*2,D0
  580.               BLO.S MT_STPLOOP
  581.               MOVEQ #35*2,D0
  582. MT_STPFOUND:
  583.               MOVE.B N_FINETUNE(A6),D2
  584.               AND.B #8,D2
  585.               BEQ.S MT_STPGOSS
  586.               TST.W D0
  587.               BEQ.S MT_STPGOSS
  588.               SUBQ.W #2,D0
  589. MT_STPGOSS:
  590.               MOVE.W 0(A0,D0.w),D2
  591.               MOVEA.L (SP)+,A0
  592.               MOVE.W D2,N_WANTEDPERIOD(A6)
  593.               MOVE.W N_PERIOD(A6),D0
  594.               CLR.B N_TONEPORTDIREC(A6)
  595.               CMP.W D0,D2
  596.               BEQ.S MT_CLEARTONEPORTA
  597.               BGE MT_RETURN2
  598.               MOVE.B #1,N_TONEPORTDIREC(A6)
  599.               RTS
  600.  
  601. MT_CLEARTONEPORTA:
  602.               CLR.W N_WANTEDPERIOD(A6)
  603.               RTS
  604.  
  605. MT_TONEPORTAMENTO:
  606.               MOVE.B N_CMDLO(A6),D0
  607.               BEQ.S MT_TONEPORTNOCHANGE
  608.               MOVE.B D0,N_TONEPORTSPEED(A6)
  609.               CLR.B N_CMDLO(A6)
  610. MT_TONEPORTNOCHANGE:
  611.               TST.W N_WANTEDPERIOD(A6)
  612.               BEQ MT_RETURN2
  613.               MOVEQ #0,D0
  614.               MOVE.B N_TONEPORTSPEED(A6),D0
  615.               TST.B N_TONEPORTDIREC(A6)
  616.               BNE.S MT_TONEPORTAUP
  617. MT_TONEPORTADOWN:
  618.               ADD.W D0,N_PERIOD(A6)
  619.               MOVE.W N_WANTEDPERIOD(A6),D0
  620.               CMP.W N_PERIOD(A6),D0
  621.               BGT.S MT_TONEPORTASETPER
  622.               MOVE.W N_WANTEDPERIOD(A6),N_PERIOD(A6)
  623.               CLR.W N_WANTEDPERIOD(A6)
  624.               BRA.S MT_TONEPORTASETPER
  625.  
  626. MT_TONEPORTAUP:
  627.               SUB.W D0,N_PERIOD(A6)
  628.               MOVE.W N_WANTEDPERIOD(A6),D0
  629.               CMP.W N_PERIOD(A6),D0
  630.               BLT.S MT_TONEPORTASETPER
  631.               MOVE.W N_WANTEDPERIOD(A6),N_PERIOD(A6)
  632.               CLR.W N_WANTEDPERIOD(A6)
  633.  
  634. MT_TONEPORTASETPER:
  635.               MOVE.W N_PERIOD(A6),D2
  636.               MOVE.B N_GLISSFUNK(A6),D0
  637.               AND.B #$0F,D0
  638.               BEQ.S MT_GLISSSKIP
  639.               MOVEQ #0,D0
  640.               MOVE.B N_FINETUNE(A6),D0
  641.               MULU #36*2,D0
  642.               LEA MT_PERIODTABLE(PC),A0
  643.               ADDA.L D0,A0
  644.               MOVEQ #0,D0
  645. MT_GLISSLOOP:
  646.               CMP.W 0(A0,D0.w),D2
  647.               BHS.S MT_GLISSFOUND
  648.               ADDQ.W #2,D0
  649.               CMP.W #36*2,D0
  650.               BLO.S MT_GLISSLOOP
  651.               MOVEQ #35*2,D0
  652. MT_GLISSFOUND:
  653.               MOVE.W 0(A0,D0.w),D2
  654. MT_GLISSSKIP:
  655.               MOVE.W D2,6(A5)           ; Set period
  656.               RTS
  657.  
  658. MT_VIBRATO:
  659.               MOVE.B N_CMDLO(A6),D0
  660.               BEQ.S MT_VIBRATO2
  661.               MOVE.B N_VIBRATOCMD(A6),D2
  662.               AND.B #$0F,D0
  663.               BEQ.S MT_VIBSKIP
  664.               AND.B #$F0,D2
  665.               OR.B D0,D2
  666. MT_VIBSKIP:
  667.               MOVE.B N_CMDLO(A6),D0
  668.               AND.B #$F0,D0
  669.               BEQ.S MT_VIBSKIP2
  670.               AND.B #$0F,D2
  671.               OR.B D0,D2
  672. MT_VIBSKIP2:
  673.               MOVE.B D2,N_VIBRATOCMD(A6)
  674. MT_VIBRATO2:
  675.               MOVE.B N_VIBRATOPOS(A6),D0
  676.               LEA MT_VIBRATOTABLE(PC),A4
  677.               LSR.W #2,D0
  678.               AND.W #$001F,D0
  679.               MOVEQ #0,D2
  680.               MOVE.B N_WAVECONTROL(A6),D2
  681.               AND.B #$03,D2
  682.               BEQ.S MT_VIB_SINE
  683.               LSL.B #3,D0
  684.               CMP.B #1,D2
  685.               BEQ.S MT_VIB_RAMPDOWN
  686.               MOVE.B #255,D2
  687.               BRA.S MT_VIB_SET
  688. MT_VIB_RAMPDOWN:
  689.               TST.B N_VIBRATOPOS(A6)
  690.               BPL.S MT_VIB_RAMPDOWN2
  691.               MOVE.B #255,D2
  692.               SUB.B D0,D2
  693.               BRA.S MT_VIB_SET
  694. MT_VIB_RAMPDOWN2:
  695.               MOVE.B D0,D2
  696.               BRA.S MT_VIB_SET
  697. MT_VIB_SINE:
  698.               MOVE.B 0(A4,D0.w),D2
  699. MT_VIB_SET:
  700.               MOVE.B N_VIBRATOCMD(A6),D0
  701.               AND.W #15,D0
  702.               MULU D0,D2
  703.               LSR.W #7,D2
  704.               MOVE.W N_PERIOD(A6),D0
  705.               TST.B N_VIBRATOPOS(A6)
  706.               BMI.S MT_VIBRATONEG
  707.               ADD.W D2,D0
  708.               BRA.S MT_VIBRATO3
  709. MT_VIBRATONEG:
  710.               SUB.W D2,D0
  711. MT_VIBRATO3:
  712.               MOVE.W D0,6(A5)
  713.               MOVE.B N_VIBRATOCMD(A6),D0
  714.               LSR.W #2,D0
  715.               AND.W #$003C,D0
  716.               ADD.B D0,N_VIBRATOPOS(A6)
  717.               RTS
  718.  
  719. MT_TONEPLUSVOLSLIDE:
  720.               BSR MT_TONEPORTNOCHANGE
  721.               BRA MT_VOLUMESLIDE
  722.  
  723. MT_VIBRATOPLUSVOLSLIDE:
  724.               BSR.S MT_VIBRATO2
  725.               BRA MT_VOLUMESLIDE
  726.  
  727. MT_TREMOLO:
  728.               MOVE.B N_CMDLO(A6),D0
  729.               BEQ.S MT_TREMOLO2
  730.               MOVE.B N_TREMOLOCMD(A6),D2
  731.               AND.B #$0F,D0
  732.               BEQ.S MT_TRESKIP
  733.               AND.B #$F0,D2
  734.               OR.B D0,D2
  735. MT_TRESKIP:
  736.               MOVE.B N_CMDLO(A6),D0
  737.               AND.B #$F0,D0
  738.               BEQ.S MT_TRESKIP2
  739.               AND.B #$0F,D2
  740.               OR.B D0,D2
  741. MT_TRESKIP2:
  742.               MOVE.B D2,N_TREMOLOCMD(A6)
  743. MT_TREMOLO2:
  744.               MOVE.B N_TREMOLOPOS(A6),D0
  745.               LEA MT_VIBRATOTABLE(PC),A4
  746.               LSR.W #2,D0
  747.               AND.W #$001F,D0
  748.               MOVEQ #0,D2
  749.               MOVE.B N_WAVECONTROL(A6),D2
  750.               LSR.B #4,D2
  751.               AND.B #$03,D2
  752.               BEQ.S MT_TRE_SINE
  753.               LSL.B #3,D0
  754.               CMP.B #1,D2
  755.               BEQ.S MT_TRE_RAMPDOWN
  756.               MOVE.B #255,D2
  757.               BRA.S MT_TRE_SET
  758. MT_TRE_RAMPDOWN:
  759.               TST.B N_VIBRATOPOS(A6)
  760.               BPL.S MT_TRE_RAMPDOWN2
  761.               MOVE.B #255,D2
  762.               SUB.B D0,D2
  763.               BRA.S MT_TRE_SET
  764. MT_TRE_RAMPDOWN2:
  765.               MOVE.B D0,D2
  766.               BRA.S MT_TRE_SET
  767. MT_TRE_SINE:
  768.               MOVE.B 0(A4,D0.w),D2
  769. MT_TRE_SET:
  770.               MOVE.B N_TREMOLOCMD(A6),D0
  771.               AND.W #15,D0
  772.               MULU D0,D2
  773.               LSR.W #6,D2
  774.               MOVEQ #0,D0
  775.               MOVE.B N_VOLUME(A6),D0
  776.               TST.B N_TREMOLOPOS(A6)
  777.               BMI.S MT_TREMOLONEG
  778.               ADD.W D2,D0
  779.               BRA.S MT_TREMOLO3
  780. MT_TREMOLONEG:
  781.               SUB.W D2,D0
  782. MT_TREMOLO3:
  783.               BPL.S MT_TREMOLOSKIP
  784.               CLR.W D0
  785. MT_TREMOLOSKIP:
  786.               CMP.W #$0040,D0
  787.               BLS.S MT_TREMOLOOK
  788.               MOVE.W #$0040,D0
  789. MT_TREMOLOOK:
  790.               MOVE.W D0,8(A5)
  791.               MOVE.B N_TREMOLOCMD(A6),D0
  792.               LSR.W #2,D0
  793.               AND.W #$003C,D0
  794.               ADD.B D0,N_TREMOLOPOS(A6)
  795.               RTS
  796.  
  797. MT_SAMPLEOFFSET:
  798.               MOVEQ #0,D0
  799.               MOVE.B N_CMDLO(A6),D0
  800.               BEQ.S MT_SONONEW
  801.               MOVE.B D0,N_SAMPLEOFFSET(A6)
  802. MT_SONONEW:
  803.               MOVE.B N_SAMPLEOFFSET(A6),D0
  804.               LSL.W #7,D0
  805.               CMP.W N_LENGTH(A6),D0
  806.               BGE.S MT_SOFSKIP
  807.               SUB.W D0,N_LENGTH(A6)
  808.               LSL.W #1,D0
  809.               ADD.L D0,N_START(A6)
  810.               RTS
  811. MT_SOFSKIP:
  812.               MOVE.W #$0001,N_LENGTH(A6)
  813.               RTS
  814.  
  815. MT_VOLUMESLIDE:
  816.               MOVEQ #0,D0
  817.               MOVE.B N_CMDLO(A6),D0
  818.               LSR.B #4,D0
  819.               TST.B D0
  820.               BEQ.S MT_VOLSLIDEDOWN
  821. MT_VOLSLIDEUP:
  822.               ADD.B D0,N_VOLUME(A6)
  823.               CMPI.B #$40,N_VOLUME(A6)
  824.               BMI.S MT_VSUSKIP
  825.               MOVE.B #$40,N_VOLUME(A6)
  826. MT_VSUSKIP:
  827.               MOVE.B N_VOLUME(A6),D0
  828.               MOVE.W D0,8(A5)
  829.               RTS
  830.  
  831. MT_VOLSLIDEDOWN:
  832.               MOVEQ #0,D0
  833.               MOVE.B N_CMDLO(A6),D0
  834.               AND.B #$0F,D0
  835. MT_VOLSLIDEDOWN2:
  836.               SUB.B D0,N_VOLUME(A6)
  837.               BPL.S MT_VSDSKIP
  838.               CLR.B N_VOLUME(A6)
  839. MT_VSDSKIP:
  840.               MOVE.B N_VOLUME(A6),D0
  841.               MOVE.W D0,8(A5)
  842.               RTS
  843.  
  844. MT_POSITIONJUMP:
  845.               MOVE.B N_CMDLO(A6),D0
  846.               SUBQ.B #1,D0
  847.               MOVE.B D0,MT_SONGPOS
  848. MT_PJ2:       CLR.B MT_PBREAKPOS
  849.               ST  MT_POSJUMPFLAG
  850.               RTS
  851.  
  852. MT_VOLUMECHANGE:
  853.               MOVEQ #0,D0
  854.               MOVE.B N_CMDLO(A6),D0
  855.               CMP.B #$40,D0
  856.               BLS.S MT_VOLUMEOK
  857.               MOVEQ #$40,D0
  858. MT_VOLUMEOK:
  859.               MOVE.B D0,N_VOLUME(A6)
  860.               MOVE.W D0,8(A5)
  861.               RTS
  862.  
  863. MT_PATTERNBREAK:
  864.               MOVEQ #0,D0
  865.               MOVE.B N_CMDLO(A6),D0
  866.               MOVE.L D0,D2
  867.               LSR.B #4,D0
  868.               MULU #10,D0
  869.               AND.B #$0F,D2
  870.               ADD.B D2,D0
  871.               CMP.B #63,D0
  872.               BHI.S MT_PJ2
  873.               MOVE.B D0,MT_PBREAKPOS
  874.               ST  MT_POSJUMPFLAG
  875.               RTS
  876.  
  877. MT_SETSPEED:
  878.               MOVE.B 3(A6),D0
  879.               BEQ MT_RETURN2
  880.               CLR.B MT_COUNTER
  881.               MOVE.B D0,MT_SPEED
  882.               RTS
  883.  
  884. MT_CHECKMOREEFX:
  885.               BSR MT_UPDATEFUNK
  886.               MOVE.B 2(A6),D0
  887.               AND.B #$0F,D0
  888.               CMP.B #$09,D0
  889.               BEQ MT_SAMPLEOFFSET
  890.               CMP.B #$0B,D0
  891.               BEQ MT_POSITIONJUMP
  892.               CMP.B #$0D,D0
  893.               BEQ.S MT_PATTERNBREAK
  894.               CMP.B #$0E,D0
  895.               BEQ.S MT_E_COMMANDS
  896.               CMP.B #$0F,D0
  897.               BEQ.S MT_SETSPEED
  898.               CMP.B #$0C,D0
  899.               BEQ MT_VOLUMECHANGE
  900.               BRA MT_PERNOP
  901.  
  902. MT_E_COMMANDS:
  903.               MOVE.B N_CMDLO(A6),D0
  904.               AND.B #$F0,D0
  905.               LSR.B #4,D0
  906.               BEQ.S MT_FILTERONOFF
  907.               CMP.B #1,D0
  908.               BEQ MT_FINEPORTAUP
  909.               CMP.B #2,D0
  910.               BEQ MT_FINEPORTADOWN
  911.               CMP.B #3,D0
  912.               BEQ.S MT_SETGLISSCONTROL
  913.               CMP.B #4,D0
  914.               BEQ MT_SETVIBRATOCONTROL
  915.               CMP.B #5,D0
  916.               BEQ MT_SETFINETUNE
  917.               CMP.B #6,D0
  918.               BEQ MT_JUMPLOOP
  919.               CMP.B #7,D0
  920.               BEQ MT_SETTREMOLOCONTROL
  921.               CMP.B #9,D0
  922.               BEQ MT_RETRIGNOTE
  923.               CMP.B #$0A,D0
  924.               BEQ MT_VOLUMEFINEUP
  925.               CMP.B #$0B,D0
  926.               BEQ MT_VOLUMEFINEDOWN
  927.               CMP.B #$0C,D0
  928.               BEQ MT_NOTECUT
  929.               CMP.B #$0D,D0
  930.               BEQ MT_NOTEDELAY
  931.               CMP.B #$0E,D0
  932.               BEQ MT_PATTERNDELAY
  933.               CMP.B #$0F,D0
  934.               BEQ MT_FUNKIT
  935.               RTS
  936.  
  937. MT_FILTERONOFF:
  938. *              MOVE.B N_CMDLO(A6),D0
  939. *              AND.B #1,D0
  940. *              ASL.B #1,D0
  941. *              ANDI.B #$FD,$00BFE001
  942. *              OR.B D0,$00BFE001
  943.               RTS
  944.  
  945. MT_SETGLISSCONTROL:
  946.               MOVE.B N_CMDLO(A6),D0
  947.               AND.B #$0F,D0
  948.               ANDI.B #$F0,N_GLISSFUNK(A6)
  949.               OR.B D0,N_GLISSFUNK(A6)
  950.               RTS
  951.  
  952. MT_SETVIBRATOCONTROL:
  953.               MOVE.B N_CMDLO(A6),D0
  954.               AND.B #$0F,D0
  955.               ANDI.B #$F0,N_WAVECONTROL(A6)
  956.               OR.B D0,N_WAVECONTROL(A6)
  957.               RTS
  958.  
  959. MT_SETFINETUNE:
  960.               MOVE.B N_CMDLO(A6),D0
  961.               AND.B #$0F,D0
  962.               MOVE.B D0,N_FINETUNE(A6)
  963.               RTS
  964.  
  965. MT_JUMPLOOP:
  966.               TST.B MT_COUNTER
  967.               BNE MT_RETURN2
  968.               MOVE.B N_CMDLO(A6),D0
  969.               AND.B #$0F,D0
  970.               BEQ.S MT_SETLOOP
  971.               TST.B N_LOOPCOUNT(A6)
  972.               BEQ.S MT_JUMPCNT
  973.               SUBQ.B #1,N_LOOPCOUNT(A6)
  974.               BEQ MT_RETURN2
  975. MT_JMPLOOP:   MOVE.B N_PATTPOS(A6),MT_PBREAKPOS
  976.               ST  MT_PBREAKFLAG
  977.               RTS
  978.  
  979. MT_JUMPCNT:
  980.               MOVE.B D0,N_LOOPCOUNT(A6)
  981.               BRA.S MT_JMPLOOP
  982.  
  983. MT_SETLOOP:
  984.               MOVE.W MT_PATTERNPOS(PC),D0
  985.               LSR.W #4,D0
  986.               MOVE.B D0,N_PATTPOS(A6)
  987.               RTS
  988.  
  989. MT_SETTREMOLOCONTROL:
  990.               MOVE.B N_CMDLO(A6),D0
  991.               AND.B #$0F,D0
  992.               LSL.B #4,D0
  993.               ANDI.B #$0F,N_WAVECONTROL(A6)
  994.               OR.B D0,N_WAVECONTROL(A6)
  995.               RTS
  996.  
  997. MT_RETRIGNOTE:
  998.               MOVE.L D1,-(SP)
  999.               MOVEQ #0,D0
  1000.               MOVE.B N_CMDLO(A6),D0
  1001.               AND.B #$0F,D0
  1002.               BEQ.S MT_RTNEND
  1003.               MOVEQ #0,D1
  1004.               MOVE.B MT_COUNTER(PC),D1
  1005.               BNE.S MT_RTNSKP
  1006.               MOVE.W (A6),D1
  1007.               AND.W #$0FFF,D1
  1008.               BNE.S MT_RTNEND
  1009.               MOVEQ #0,D1
  1010.               MOVE.B MT_COUNTER(PC),D1
  1011. MT_RTNSKP:
  1012.               DIVU D0,D1
  1013.               SWAP D1
  1014.               TST.W D1
  1015.               BNE.S MT_RTNEND
  1016. MT_DORETRIG:
  1017. *              MOVE.W N_DMABIT(A6),$00DFF096 ; Channel DMA off
  1018. *            move.w    n_dmabit(a6),-(sp)
  1019. *            bsr        dff096_contr
  1020. *            addq.w    #2,sp        
  1021.               MOVE.L N_START(A6),(A5)   ; Set sampledata pointer
  1022.               MOVE.W N_LENGTH(A6),4(A5) ; Set length
  1023. *              MOVE.W #300,D0
  1024. *MT_RTNLOOP1:
  1025. *              DBRA D0,MT_RTNLOOP1
  1026. *              MOVE.W N_DMABIT(A6),D0
  1027. *              BSET #15,D0
  1028. *              MOVE.W D0,$00DFF096
  1029. *            move.w    d0,-(sp)
  1030. *            bsr        dff096_contr
  1031. *            addq.w    #2,sp
  1032. *              MOVE.W #300,D0
  1033. *MT_RTNLOOP2:
  1034. *              DBRA D0,MT_RTNLOOP2
  1035.               MOVE.L N_LOOPSTART(A6),10(A5)    ;kein +10
  1036.               MOVE.w N_REPLEN(A6),4+10(A5)     ;war .l  / kein +10
  1037. MT_RTNEND:
  1038.               MOVE.L (SP)+,D1
  1039.               RTS
  1040.  
  1041. MT_VOLUMEFINEUP:
  1042.               TST.B MT_COUNTER
  1043.               BNE MT_RETURN2
  1044.               MOVEQ #0,D0
  1045.               MOVE.B N_CMDLO(A6),D0
  1046.               AND.B #$0F,D0
  1047.               BRA MT_VOLSLIDEUP
  1048.  
  1049. MT_VOLUMEFINEDOWN:
  1050.               TST.B MT_COUNTER
  1051.               BNE MT_RETURN2
  1052.               MOVEQ #0,D0
  1053.               MOVE.B N_CMDLO(A6),D0
  1054.               AND.B #$0F,D0
  1055.               BRA MT_VOLSLIDEDOWN2
  1056.  
  1057. MT_NOTECUT:
  1058.               MOVEQ #0,D0
  1059.               MOVE.B N_CMDLO(A6),D0
  1060.               AND.B #$0F,D0
  1061.               CMP.B MT_COUNTER(PC),D0
  1062.               BNE MT_RETURN2
  1063.               CLR.B N_VOLUME(A6)
  1064.               MOVE.W #0,8(A5)
  1065.               RTS
  1066.  
  1067. MT_NOTEDELAY:
  1068.               MOVEQ #0,D0
  1069.               MOVE.B N_CMDLO(A6),D0
  1070.               AND.B #$0F,D0
  1071.               CMP.B MT_COUNTER,D0
  1072.               BNE MT_RETURN2
  1073.               MOVE.W (A6),D0
  1074.               BEQ MT_RETURN2
  1075.               MOVE.L D1,-(SP)
  1076.               BRA MT_DORETRIG
  1077.  
  1078. MT_PATTERNDELAY:
  1079.               TST.B MT_COUNTER
  1080.               BNE MT_RETURN2
  1081.               MOVEQ #0,D0
  1082.               MOVE.B N_CMDLO(A6),D0
  1083.               AND.B #$0F,D0
  1084.               TST.B MT_PATTDELTIME2
  1085.               BNE MT_RETURN2
  1086.               ADDQ.B #1,D0
  1087.               MOVE.B D0,MT_PATTDELTIME
  1088.               RTS
  1089.  
  1090. MT_FUNKIT:
  1091.               TST.B MT_COUNTER
  1092.               BNE MT_RETURN2
  1093.               MOVE.B N_CMDLO(A6),D0
  1094.               AND.B #$0F,D0
  1095.               LSL.B #4,D0
  1096.               ANDI.B #$0F,N_GLISSFUNK(A6)
  1097.               OR.B D0,N_GLISSFUNK(A6)
  1098.               TST.B D0
  1099.               BEQ MT_RETURN2
  1100. MT_UPDATEFUNK:
  1101.               MOVEM.L D1/A0,-(SP)
  1102.               MOVEQ #0,D0
  1103.               MOVE.B N_GLISSFUNK(A6),D0
  1104.               LSR.B #4,D0
  1105.               BEQ.S MT_FUNKEND
  1106.               LEA MT_FUNKTABLE(PC),A0
  1107.               MOVE.B 0(A0,D0.w),D0
  1108.               ADD.B D0,N_FUNKOFFSET(A6)
  1109.               BTST #7,N_FUNKOFFSET(A6)
  1110.               BEQ.S MT_FUNKEND
  1111.               CLR.B N_FUNKOFFSET(A6)
  1112.  
  1113.               MOVE.L N_LOOPSTART(A6),D0
  1114.               MOVEQ #0,D1
  1115.               MOVE.W N_REPLEN(A6),D1
  1116.               ADD.L D1,D0
  1117.               ADD.L D1,D0
  1118.               MOVEA.L N_WAVESTART(A6),A0
  1119.               ADDQ.L #1,A0
  1120.               CMPA.L D0,A0
  1121.               BLO.S MT_FUNKOK
  1122.               MOVEA.L N_LOOPSTART(A6),A0
  1123. MT_FUNKOK:
  1124.               MOVE.L A0,N_WAVESTART(A6)
  1125.               MOVEQ #-1,D0
  1126.               SUB.B (A0),D0
  1127.               MOVE.B D0,(A0)
  1128. MT_FUNKEND:
  1129.               MOVEM.L (SP)+,D1/A0
  1130.               RTS
  1131.  
  1132.  
  1133. MT_FUNKTABLE: DC.B 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  1134.  
  1135. MT_VIBRATOTABLE:
  1136.               DC.B 0,24,49,74,97,120,141,161
  1137.               DC.B 180,197,212,224,235,244,250,253
  1138.               DC.B 255,253,250,244,235,224,212,197
  1139.               DC.B 180,161,141,120,97,74,49,24
  1140.  
  1141. MT_PERIODTABLE:
  1142. ; Tuning 0, Normal
  1143.               DC.W 856,808,762,720,678,640,604,570,538,508,480,453
  1144.               DC.W 428,404,381,360,339,320,302,285,269,254,240,226
  1145.               DC.W 214,202,190,180,170,160,151,143,135,127,120,113
  1146. ; Tuning 1
  1147.               DC.W 850,802,757,715,674,637,601,567,535,505,477,450
  1148.               DC.W 425,401,379,357,337,318,300,284,268,253,239,225
  1149.               DC.W 213,201,189,179,169,159,150,142,134,126,119,113
  1150. ; Tuning 2
  1151.               DC.W 844,796,752,709,670,632,597,563,532,502,474,447
  1152.               DC.W 422,398,376,355,335,316,298,282,266,251,237,224
  1153.               DC.W 211,199,188,177,167,158,149,141,133,125,118,112
  1154. ; Tuning 3
  1155.               DC.W 838,791,746,704,665,628,592,559,528,498,470,444
  1156.               DC.W 419,395,373,352,332,314,296,280,264,249,235,222
  1157.               DC.W 209,198,187,176,166,157,148,140,132,125,118,111
  1158. ; Tuning 4
  1159.               DC.W 832,785,741,699,660,623,588,555,524,495,467,441
  1160.               DC.W 416,392,370,350,330,312,294,278,262,247,233,220
  1161.               DC.W 208,196,185,175,165,156,147,139,131,124,117,110
  1162. ; Tuning 5
  1163.               DC.W 826,779,736,694,655,619,584,551,520,491,463,437
  1164.               DC.W 413,390,368,347,328,309,292,276,260,245,232,219
  1165.               DC.W 206,195,184,174,164,155,146,138,130,123,116,109
  1166. ; Tuning 6
  1167.               DC.W 820,774,730,689,651,614,580,547,516,487,460,434
  1168.               DC.W 410,387,365,345,325,307,290,274,258,244,230,217
  1169.               DC.W 205,193,183,172,163,154,145,137,129,122,115,109
  1170. ; Tuning 7
  1171.               DC.W 814,768,725,684,646,610,575,543,513,484,457,431
  1172.               DC.W 407,384,363,342,323,305,288,272,256,242,228,216
  1173.               DC.W 204,192,181,171,161,152,144,136,128,121,114,108
  1174. ; Tuning -8
  1175.               DC.W 907,856,808,762,720,678,640,604,570,538,508,480
  1176.               DC.W 453,428,404,381,360,339,320,302,285,269,254,240
  1177.               DC.W 226,214,202,190,180,170,160,151,143,135,127,120
  1178. ; Tuning -7
  1179.               DC.W 900,850,802,757,715,675,636,601,567,535,505,477
  1180.               DC.W 450,425,401,379,357,337,318,300,284,268,253,238
  1181.               DC.W 225,212,200,189,179,169,159,150,142,134,126,119
  1182. ; Tuning -6
  1183.               DC.W 894,844,796,752,709,670,632,597,563,532,502,474
  1184.               DC.W 447,422,398,376,355,335,316,298,282,266,251,237
  1185.               DC.W 223,211,199,188,177,167,158,149,141,133,125,118
  1186. ; Tuning -5
  1187.               DC.W 887,838,791,746,704,665,628,592,559,528,498,470
  1188.               DC.W 444,419,395,373,352,332,314,296,280,264,249,235
  1189.               DC.W 222,209,198,187,176,166,157,148,140,132,125,118
  1190. ; Tuning -4
  1191.               DC.W 881,832,785,741,699,660,623,588,555,524,494,467
  1192.               DC.W 441,416,392,370,350,330,312,294,278,262,247,233
  1193.               DC.W 220,208,196,185,175,165,156,147,139,131,123,117
  1194. ; Tuning -3
  1195.               DC.W 875,826,779,736,694,655,619,584,551,520,491,463
  1196.               DC.W 437,413,390,368,347,328,309,292,276,260,245,232
  1197.               DC.W 219,206,195,184,174,164,155,146,138,130,123,116
  1198. ; Tuning -2
  1199.               DC.W 868,820,774,730,689,651,614,580,547,516,487,460
  1200.               DC.W 434,410,387,365,345,325,307,290,274,258,244,230
  1201.               DC.W 217,205,193,183,172,163,154,145,137,129,122,115
  1202. ; Tuning -1
  1203.               DC.W 862,814,768,725,684,646,610,575,543,513,484,457
  1204.               DC.W 431,407,384,363,342,323,305,288,272,256,242,228
  1205.               DC.W 216,203,192,181,171,161,152,144,136,128,121,114
  1206.  
  1207. MT_CHAN1TEMP: DC.L 0,0,0,0,0,$00010000,0,0,0,0,0
  1208. MT_CHAN2TEMP: DC.L 0,0,0,0,0,$00020000,0,0,0,0,0
  1209. MT_CHAN3TEMP: DC.L 0,0,0,0,0,$00040000,0,0,0,0,0
  1210. MT_CHAN4TEMP: DC.L 0,0,0,0,0,$00080000,0,0,0,0,0
  1211.  
  1212.  
  1213. ap_SAMPLETAB:
  1214. MT_SAMPLESTARTS:DC.L 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1215.               DC.L 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1216.  
  1217. MT_SONGDATAPTR:DC.L 0
  1218.  
  1219. MT_SPEED:     DC.B 6
  1220. MT_COUNTER:   DC.B 0
  1221. MT_SONGPOS:   DC.B 0
  1222. MT_PBREAKPOS: DC.B 0
  1223. MT_POSJUMPFLAG:DC.B 0
  1224. MT_PBREAKFLAG:DC.B 0
  1225. MT_LOWMASK:   DC.B 0
  1226. MT_PATTDELTIME:DC.B 0
  1227. MT_PATTDELTIME2:DC.B 0,0
  1228.  
  1229. MT_PATTERNPOS:DC.W 0
  1230. MT_DMACONTEMP:DC.W 0
  1231.  
  1232. ;/* End of File */
  1233.